﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VOD.Models;
using VOD.Controllers.Filters;

namespace VOD.Controllers
{
    public class HomeController : Controller
    {
        VODEntities db = new VODEntities();
        //
        // GET: /Index/
        [SiteCounterFilter]//用户网站访问量计数
        public ActionResult Index()
        {
            return View();
        }

        // 用于控制头部导航条的更新图标的显示
        public ActionResult NewIco()
        {
            var now = DateTime.Now.Date.AddDays(-1);
            ViewBag.MovieIco = db.v_Videos.Any(v => v.UpdateDate >= now && v.CategoryID == 2) ? "" : " class=No";
            ViewBag.TVIco = db.v_Videos.Any(v => v.UpdateDate >= now && v.CategoryID == 3) ? "" : " class=No";
            ViewBag.CartoonIco = db.v_Videos.Any(v => v.UpdateDate >= now && v.CategoryID == 4) ? "" : " class=No";
            ViewBag.VarietyIco = db.v_Videos.Any(v => v.UpdateDate >= now && v.CategoryID == 5) ? "" : " class=No";
            return View();
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}
